scripty2

class S2.UI.Button

Description

Applies button-like behavior to an element.

Superclass

Methods

Constructor

new S2.UI.Button(element[, options])
  • element (Element) – The element to serve as the button's base. Can be a typical input (with type set to submit or button); or a button or a element. The latter two options allow for more customization of the button's content.
  • options (Object) – A set of options for customizing the button.

Creates an S2.UI.Button.

Instance methods

  • setEnabled #

    S2.UI.Button#setEnabled(isEnabled) -> this
    • isEnabled (Boolean): Whether the button should be enabled.
  • toElement #

    S2.UI.Button#toElement() -> Element

    Returns the DOM element for the button. This allows button instances to be passed to certain Prototype methods that expect elements, like Element#insert.

  • toggle #

    S2.UI.Button#toggle([bool]) -> S2.UI.Button
    • bool (Boolean) – Whether the button should be active or inactive. If omitted, defaults to the opposite of the button's current state.

    Toggles the button between active and inactive. Returns the instance.

    If the button isn't a "toggle" button, the instance will immediately return itself.